<?xml version="1.0"?>
<!DOCTYPE hrc PUBLIC "-//Cail Lomecb//DTD Colorer HRC take5//EN"
  "http://colorer.sf.net/2003/hrc.dtd">
<hrc version="take5" xmlns="http://colorer.sf.net/2003/hrc"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://colorer.sf.net/2003/hrc http://colorer.sf.net/2003/hrc.xsd">

  <annotation><documentation>
   Tcl/Tk Base Syntax Highlighting
  </documentation><contributors><![CDATA[
   Created by:
     Andrei Gratchev <angra@intrinsix.com>

   Changes:
       18.04.01 (Andrei Gratchev):
           Namespaces, Variables blocks has rewrited from scratch.
           Added support of Predifined variables.
           Behavior of "slashed" chars has fixed.
           Paired brackets now is working more accurate.
           And many minor changes.
  ]]></contributors></annotation>

  <type name="tcltk">
    <import type="def"/>

    <region name="tclString" parent="String"/>
    <region name="tclArrayNm" parent="StringContent"/>
    <region name="tclChar" parent="CharacterContent"/>
    <region name="tclComment" parent="Comment"/>
    <region name="tclSymb" parent="Symbol"/>
    <region name="tclMainSymb" parent="SymbolStrong"/>
    <region name="tclBase" parent="Keyword"/>
    <region name="tclWord" parent="Keyword"/>
    <region name="tclNumb" parent="Number"/>
    <region name="tclVar" parent="Var"/>
    <region name="tclVar2" parent="VarStrong"/>
    <region name="tclFunc" parent="Function"/>
    <region name="tclParam" parent="Parameter"/>
    <region name="tclError" parent="Error"/>

    <region name="NamespaceOutline" parent="def:Outlined"/>
    <region name="ProcOutline" parent="def:Outlined"/>

    <scheme name="tcltkBase">
<!-- base syntax -->
      <keywords region="tclBase">
         <word name="break"/>      <word name="case"/>     <word name="catch"/>
         <word name="continue"/>   <word name="for"/>      <word name="foreach"/>
         <word name="global"/>     <word name="if"/>       <word name="else"/>
         <word name="elseif"/>     <word name="proc"/>     <word name="return"/>
         <word name="set"/>        <word name="source"/>   <word name="switch"/>
         <word name="unset"/>      <word name="uplevel"/>  <word name="upvar"/>
         <word name="variable"/>   <word name="while"/>    <word name="namespace"/>
      </keywords>
    </scheme>

    <scheme name="tcltkWord">
      <keywords region="tclWord">
         <!-- tcl commands -->
         <word name="after"/>      <word name="append"/>   <word name="bgerror"/>
         <word name="binary"/>     <word name="array"/>    <word name="cd"/>
         <word name="clock"/>      <word name="close"/>    <word name="concat"/>
         <word name="eof"/>        <word name="error"/>    <word name="eval"/>
         <word name="exec"/>       <word name="exit"/>     <word name="expr"/>
         <word name="fblocked"/>   <word name="fcopy"/>    <word name="fconfigure"/>
         <word name="file"/>       <word name="fileevent"/><word name="filename"/>
         <word name="flush"/>      <word name="format"/>   <word name="gets"/>
         <word name="glob"/>       <word name="history"/>  <word name="incr"/>
         <word name="info"/>       <word name="interp"/>   <word name="join"/>
         <word name="lappend"/>    <word name="library"/>  <word name="lindex"/>
         <word name="linsert"/>    <word name="list"/>     <word name="llength"/>
         <word name="load"/>       <word name="lrange"/>   <word name="lreplace"/>
         <word name="lsearch"/>    <word name="lsort"/>    <word name="vwait"/>
         <word name="open"/>       <word name="package"/>  <word name="pid"/>
         <word name="pkg_mkindex"/><word name="puts"/>     <word name="pwd"/>
         <word name="read"/>       <word name="regexp"/>   <word name="regsub"/>
         <word name="rename"/>     <word name="resource"/> <word name="scan"/>
         <word name="seek"/>       <word name="socket"/>   <word name="split"/>
         <word name="string"/>     <word name="subst"/>    <word name="tell"/>
         <word name="time"/>       <word name="trace"/>    <word name="update"/>
         <!-- tk commands -->
         <word name="bell"/>       <word name="bind"/>     <word name="bindtags"/>
         <word name="bitmap"/>     <word name="button"/>   <word name="canvas"/>
         <word name="checkbutton"/><word name="clipboard"/><word name="destroy"/>
         <word name="entry"/>      <word name="event"/>    <word name="focus"/>
         <word name="font"/>       <word name="frame"/>    <word name="grab"/>
         <word name="grid"/>       <word name="image"/>    <word name="label"/>
         <word name="listbox"/>    <word name="lower"/>    <word name="menu"/>
         <word name="menubutton"/> <word name="message"/>  <word name="option"/>
         <word name="pack"/>       <word name="pack-old"/> <word name="photo"/>
         <word name="place"/>      <word name="raise"/>    <word name="radiobutton"/>
         <word name="scale"/>      <word name="scrollbar"/><word name="selection"/>
         <word name="send"/>       <word name="text"/>     <word name="tk_menuBar"/>
         <word name="tk_bindForTraversal"/>                <word name="tk_bisque"/>
         <word name="tk_setPalette"/>                      <word name="tk_chooseColor"/>
         <word name="tk_dialog"/>                          <word name="tk_focusFollowsMouse"/>
         <word name="tk_focusNext"/>                       <word name="tk_focusPrev"/>
         <word name="tk_getOpenFile"/>                     <word name="tk_getSaveFile"/>
         <word name="tk_messageBox"/>                      <word name="tk_optionMenu"/>
         <word name="tk_popup"/>   <word name="tkerror"/>  <word name="tkwait"/>
         <word name="toplevel"/>   <word name="winfo"/>    <word name="wm"/>
         <!-- expect commands -->
         <word name="expect"/> <word name="exp_internal"/> <word name="send"/>
         <word name="spawn"/>  <word name="send_user"/>    <word name="send_error"/>
      </keywords>
    </scheme>

    <scheme name="tcltkPairedBrackets">
      <!-- Paired block -->
      <block start="/(\{)/" end="/(\})/" scheme="tcltkPairedBrackets"
             region00="tclMainSymb" region01="def:PairStart"
             region10="tclMainSymb" region11="def:PairEnd"/>
      <block start="/(\()/" end="/(\))/" scheme="tcltkPairedBrackets"
             region00="tclSymb" region01="def:PairStart"
             region10="tclSymb" region11="def:PairEnd"/>
      <block start="/(\[)/" end="/(\])/" scheme="tcltkPairedBrackets"
             region00="tclMainSymb" region01="def:PairStart"
             region10="tclMainSymb" region11="def:PairEnd"/>
    </scheme>

    <scheme name="tcltkPredefinedVar">
      <regexp match="/(\$|\s?#1)(::)?((errorCode)|(errorInfo)|(tcl_library)|
                             (tcl_patchLevel)|(tcl_pkgPath)|(tcl_precision)|
                             (tcl_rcFileName)|(tcl_traceExec)|(tcl_version)|
                             (tcl_rcRsrcName)|(tcl_traceCompile)|
                             (tk_library)|(tk_patchLevel)|(argv0)|(argv)|(argc)|
                             (tk_strictMotif)|(tk_version))\B/x"
              region0="tclVar2"  region2="tclMainSymb" region3="tclVar2" />
      <!-- Following variables has array type and needs
           the special handling -->
      <block start="/(\$|\s?#1)(::)?((env)|(tcl_platform))(\()/" end="/(\))|$/"
             scheme="tcltkString" priority="low"
             region="tclArrayNm" region00="tclSymb" region01="tclVar2"
             region02="tclMainSymb" region03="tclVar2" region06="def:PairStart"
             region10="tclSymb" region11="def:PairEnd"/>
    </scheme>

    <scheme name="tcltkSymbol">
      <!-- operators -->
      <keywords region="tclSymb">
        <symb name="="/> <symb name="/"/> <symb name="&amp;"/>
        <symb name="|"/> <symb name=">"/> <symb name="%"/>
        <symb name="~"/> <symb name="^"/> <symb name="&lt;"/>
        <symb name="+"/> <symb name="-"/> <symb name="*"/>
        <symb name=","/> <symb name="\"/> <symb name="!"/>
        <symb name=";"/> <word name="::" region="tclMainSymb"/>
      </keywords>
    </scheme>

    <scheme name="tcltkError">
      <keywords region="tclError">
        <symb name="("/> <symb name=")"/>
        <symb name="{"/> <symb name="}"/>
        <symb name="["/> <symb name="]"/>
      </keywords>
    </scheme>

    <scheme name="tcltkNamespace">
      <inherit scheme="tcltkPredefinedVar"/>
      <block start="/\$(\{)/" end="/(\})|$/" scheme="def:empty"
             region="tclVar2" region00="tclVar2"
             region01="tclSymb" region11="tclSymb"/>
      <block start="/(::)?[\w]*((\())\m/" end="/(\))|$/"
             scheme="tcltkString" region="tclArrayNm"
             region01="tclMainSymb" region02="def:PairStart" region03="tclSymb"
             region10="tclSymb" region11="def:PairEnd"/>
      <regexp match="/(::)[\w]*/" region1="tclMainSymb"/>
    </scheme>

    <scheme name="tcltkVar">
      <inherit scheme="tcltkPredefinedVar"/>
      <block start="/\$(\{)/" end="/(\})|$/" scheme="def:empty"
             region="tclVar2" region00="tclVar2" region01="tclSymb"
             region11="tclSymb"/>
      <block start="/(\$)(::)?([\w]*)(\()/" end="/(\))|$/" scheme="tcltkString"
             priority="low" region="tclArrayNm"
             region00="tclSymb" region01="tclVar" region02="tclMainSymb"
             region03="tclVar" region04="def:PairStart"
             region10="tclSymb" region11="def:PairEnd"/>
      <block start="/\$(::)?[\w]*/" end="/\M([^\w])|$/" scheme="tcltkNamespace"
             region="tclVar" region00="tclVar" region01="tclMainSymb"/>
    </scheme>

    <scheme name="tcltkNumb">
      <inherit scheme="def:CHexNumber"/>
      <regexp match="/\b(0[xX])/" region0="tclError"/>
      <inherit scheme="def:FloatNumber"/>
      <inherit scheme="def:DecNumber"/>
    </scheme>

    <scheme name="tcltkSpec">
      <!-- Special characters -->
      <regexp match="/((\\x[\da-fA-F]{1,2})\M([^\da-fA-F]|$))|(\\x([\da-fA-F]*)?[\da-fA-F]{2})/"
              region2="tclChar" region4="tclChar" region5="tclError"/>
      <regexp match="/\\[\d]{1,3}/" region0="tclChar"/>
      <regexp match="/\\\s+$/" region0="tclError"/>
      <regexp match="/\\./" region0="tclChar"/>
    </scheme>

    <scheme name="tcltk">
      <!-- Variables -->
      <inherit scheme="tcltkVar"/>

      <!-- Numbers -->
      <inherit scheme="tcltkNumb"/>

      <!-- Strings -->
      <block start='/"/' end='/"/' scheme="tcltkString" priority="low"
             region="tclString" region00="def:PairStart" region10="def:PairEnd"/>

      <!-- Linear comments -->
      <block start="/(^|;?#1)\s*\#/" end="/([^\\]?#1$)|(\\\s+$)/" scheme="Comment"
             region="tclComment" region12="tclError"/>

      <!-- paired block for matching -->
      <inherit scheme="tcltkPairedBrackets">
        <virtual scheme="tcltkPairedBrackets" subst-scheme="tcltk"/>
      </inherit>

      <!-- Functions -->
      <block start="/^\s*\M(proc)\s+/"
             end="/(proc\s+[\w:\$]+\m\s+(([\w]+)|([&quot;\{]?=)))|(\m[&quot;\{].*?$)?=|$/" scheme="tcltkNamespace"
             region="tclFunc" region01="tclBase" region11="ProcOutline" region13="tclVar" region14="tclMainSymb"/>
      <!-- !!! Selects some user defined functions as type function in text !!! -->
      <!-- You could enable this and disable next two blocks if you like -->
      <!--
      <block start="/\M(::)?[\w]+?(::)[\w]+?/" end="/([\]};]?=)|(([^\w]?=)|$)/"
             scheme="tcltkNamespace" region="tclFunc"/>
      <block start="/\M(::)[\w]+?/" end="/([\]};]?=)|(([^\w]?=)|$)/"
             scheme="tcltkNamespace" region="tclFunc"/>
      -->
      <block start="/\M(::)?[\w]+?(::)[\w]*?/" end="/([\]};]?=)|(([^\w]?=)|$)/"
             scheme="tcltkNamespace"/>
      <block start="/\M(::)[\w]+?/" end="/([\]};]?=)|(([^\w]?=)|$)/"
             scheme="tcltkNamespace"/>

      <!-- Namespace definition -->
      <block start="/\M(namespace)\s+(eval)\s+/" end="/((namespace)\s+(eval)\s+[\w:\$]+\m\s+[&quot;\{]?=)|(\m[&quot;\{].*?$)?=|$/" scheme="tcltkNamespace"
             region="tclFunc" region01="tclBase" region02="tclWord"/>

      <!-- Specials -->
      <block start="/(^|;?#1|\{?#1|\[?#1)\s*((set)|(variable))\s+\M(::)?[\w]/"
             end="/([\]};]?=)|(([^\w\(\$]?=)|$)/" scheme="tcltkNamespace" region="tclVar" region02="tclBase"/>
      <block start="/(^|;?#1|\{?#1|\[?#1)\s*((append)|(lappend)|(incr))\s+\M(::)?[\w]/"
             end="/([\]};]?=)|(([^\w\(\$]?=)|$)/" scheme="tcltkNamespace" region="tclVar" region02="tclWord"/>
      <block start="/(^|;?#1|\{?#1|\[?#1)\s*((unset)|(global))\s+\M(::)?[\w]/"
             end="/([\]};]?=)|$/" scheme="tcltkNamespace" region="tclVar" region02="tclBase"/>
      <block start="/(^|;?#1|\{?#1|\[?#1)\s*(upvar)(\s+((\\?\#)?([\d]+)|(\$[\w]+)))?\s+/" end="/\M([;\]}])|$/" scheme="tcltkNamespace"
             region="tclVar" region02="tclBase" region03="tclNumb" region07="tclVar"/>
      <block start="/(^|;?#1|\{?#1|\[?#1)\s*(uplevel)(\s+((\\?\#)?([\d]+)|(\$[\w]+)))?/" end="/([;\]}])?=|$/" scheme="tcltk" priority="low"
             region02="tclBase" region03="tclNumb" region07="tclVar"/>
      <regexp match="/(^|;?#1|\{?#1|\[?#1)\s*(foreach)\s+(([\w]+)|([&quot;\{]?=))/"
              region0="tclVar" region2="tclBase"/>
      <regexp match="/\b((\s-)?#2[\w]+)/" region1="tclParam"/>

      <inherit scheme="tcltkSpec"/>

      <inherit scheme="tcltkBase"/>
      <inherit scheme="tcltkWord"/>
      <inherit scheme="tcltkSymbol"/>
      <inherit scheme="tcltkError"/>
    </scheme>

    <scheme name="tcltkString">
      <!-- override comments -->
      <keywords region="tclString">
        <symb name="#"/>
      </keywords>

      <inherit scheme="tcltkVar"/>

      <!-- !!! Additional parsing in srings !!! -->
      <block start="/(\[)/" end="/(\])/" scheme="tcltk" priority="low"
             region00="def:PairStart" region10="def:PairEnd"
             region01="tclMainSymb"  region11="tclMainSymb"/>

      <inherit scheme="tcltkNumb"/>
      <inherit scheme="tcltkSpec"/>
      <!-- inherit scheme="tcltkBase"/-->
      <!-- inherit scheme="tcltkWord"/-->
      <!-- inherit scheme="tcltkSymbol"/-->
      <!-- inherit scheme="tcltkError"/-->
    </scheme>

   </type>
</hrc>
<!-- ***** BEGIN LICENSE BLOCK *****
   - Version: MPL 1.1/GPL 2.0/LGPL 2.1
   -
   - The contents of this file are subject to the Mozilla Public License Version
   - 1.1 (the "License"); you may not use this file except in compliance with
   - the License. You may obtain a copy of the License at
   - http://www.mozilla.org/MPL/
   -
   - Software distributed under the License is distributed on an "AS IS" basis,
   - WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
   - for the specific language governing rights and limitations under the
   - License.
   -
   - The Original Code is the Colorer Library.
   -
   - The Initial Developer of the Original Code is
   - Cail Lomecb <cail@nm.ru>.
   - Portions created by the Initial Developer are Copyright (C) 1999-2005
   - the Initial Developer. All Rights Reserved.
   -
   - Contributor(s):
   -
   - Alternatively, the contents of this file may be used under the terms of
   - either the GNU General Public License Version 2 or later (the "GPL"), or
   - the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
   - in which case the provisions of the GPL or the LGPL are applicable instead
   - of those above. If you wish to allow use of your version of this file only
   - under the terms of either the GPL or the LGPL, and not to allow others to
   - use your version of this file under the terms of the MPL, indicate your
   - decision by deleting the provisions above and replace them with the notice
   - and other provisions required by the LGPL or the GPL. If you do not delete
   - the provisions above, a recipient may use your version of this file under
   - the terms of any one of the MPL, the GPL or the LGPL.
   -
   - ***** END LICENSE BLOCK ***** -->
